<me:UIGLLG x:Class="WPFExcelReport.TGB15"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"  
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                   x:Name="TV" 
                    Loaded="Window_Loaded"
     >
    <me:UIGLLG.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
        <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:KM2YD x:Key="KM2YD"/>
        <ucd:M2YD x:Key="M2YD"/>
    </me:UIGLLG.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition> 
        </Grid.RowDefinitions>
        <StackPanel   Grid.Row="0" Margin="10,0,0,0" VerticalAlignment="Top">
            <WrapPanel  >
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock   Grid.Column="1" Text="{Binding Source={Localization:Translate Word=新箱}}"></TextBlock>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"  >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/remove.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock   Grid.Column="1" Text="{Binding Source={Localization:Translate Word=删除纱箱}}"></TextBlock>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"  Visibility="{Binding IsCanChg, Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="EditCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" IsEnabled="{Binding IsEdit}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/save.png" />
                        </Button.Background>
                    </Button>
                    <TextBlock   Grid.Column="1" Text="{Binding Source={Localization:Translate Word=批量保存}}"></TextBlock>
                </Grid>
                <WrapPanel  Margin="10,0,0,0" VerticalAlignment="Top" >
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=批号:}}"   Margin="0,0,0,0"></TextBlock>
                        <ex:TXT72 Grid.Column="1" MaxLength="2" PRE="  " Text="{Binding RWKRS,ElementName=TV}" Width="24" />
                        <ex:TXT72 Grid.Column="2" MaxLength="6" PRE="000000" Text="{Binding RWLFD,ElementName=TV}" Width="80" />
                    </Grid>
                    <Grid >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" 
                             >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                            </Button.Background>
                        </Button>
                    </Grid>
                    <Grid Margin="10,0,0,0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=仓库:}}"></TextBlock>
                        <ex:TXT72   Grid.Column="1" MaxLength="2"  Text="{Binding LO}"  Width="30" />
                        <ex:TXT72   Grid.Column="2" MaxLength="2"  Text="{Binding LB}" Width="30" />
                        <ex:TXT72   Grid.Column="3" MaxLength="8"  Text="{Binding LP}" Width="80" />
                    </Grid>
                </WrapPanel>
            </WrapPanel>
            <WrapPanel >
                <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=箱数:}}"></TextBlock>
                <ex:NumericBox Text="{Binding NBOX,ElementName=TV}" 
                                   IsReadOnly="{Binding IsKEY, Converter={StaticResource not}}"   Grid.Column="1" DecimalPlaces="2"  FontSize="18"    
                                   Width="60" />
                <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=数量:}}"></TextBlock>
                <ex:NumericBox  Name="txtLG" Grid.Column="1" 
                                             DecimalPlaces="2"  FontSize="18"  KeyUp="QTY_KeyUp" 
                                            Text="{Binding GLBSTKG,Converter={StaticResource d1000}}" Width="80" />

                <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=筒子个数:}}"></TextBlock>
                <ex:NumericBox Grid.Column="1" 
                                      IsReadOnly="{Binding IsEdit, Converter={StaticResource not}}" 
                                      FontSize="18"  
                                      Text="{Binding GLBSTSP ,Converter={StaticResource gb2312}}" 
                                      Width="80" />
                <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=皮重:}}"></TextBlock>
                <ex:NumericBox    Grid.Column="1" 
                                             DecimalPlaces="2"  FontSize="18"  
                                            Text="{Binding GLTARA,Converter={StaticResource d1000}}" Width="80" />
                <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=净重:}}"></TextBlock>
                <ex:NumericBox   Grid.Column="1" 
                                             DecimalPlaces="2"  FontSize="18"  
                                            Text="{Binding GLBSTNET,Converter={StaticResource d1000}}" Width="80" />
                <TextBlock   Grid.Column="0" FontSize="18" Text="{Binding Source={Localization:Translate Word=备注:}}"></TextBlock>
                <ex:TXT72 Grid.Column="1" 
                                      IsReadOnly="{Binding IsEdit, Converter={StaticResource not}}" 
                                      FontSize="18" MaxLength="10"  
                                      Text="{Binding GLBEM ,Converter={StaticResource gb2312}}" 
                                      Width="160" />
            </WrapPanel>
            <WrapPanel>
                <TextBlock     Text="{Binding Source={Localization:Translate Word=库位:}}"></TextBlock>
                <TextBlock    Text="{Binding GLLO}"  Width="30" />
                <TextBlock    Text="{Binding GLLB}" Width="30" />
                <TextBlock    Text="{Binding GLLP}" Width="80" />
                <TextBlock     Text="{Binding Source={Localization:Translate Word=批号:}}"></TextBlock>
                <TextBlock    Text="{Binding GLPARTIE}"  /> 
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1" Grid.Column="0" 
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                  IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                   HeadersVisibility="Column"     
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}" 
                   IsSynchronizedWithCurrentItem="True" 
                   x:Name="dlgMaster" 
                    RowDetailsVisibilityMode="Visible"  Margin="0,0,0,0">
            <DataGrid.Columns>
                <DataGridCheckBoxColumn Width="40" Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type DataGridRow}}}">
                    <DataGridCheckBoxColumn.HeaderTemplate>
                        <DataTemplate>
                            <CheckBox x:Name="ckbSelectedAll" Checked="ckbSelectedAll_Click" Unchecked="ckbSelectedAll_Unchecked"></CheckBox>
                        </DataTemplate>
                    </DataGridCheckBoxColumn.HeaderTemplate>
                </DataGridCheckBoxColumn>
                <DataGridTextColumn   Header="{Binding Source={Localization:Translate Word=箱号}}" Foreground="Red" Binding="{Binding GLLBEH}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=总重}}" Binding="{Binding GLBSTKG,Converter={StaticResource ResourceKey=d1000}}"/>
                <DataGridTextColumn  Header="{Binding Source={Localization:Translate Word=净重}}" Binding="{Binding GLBSTNET,Converter={StaticResource ResourceKey=d1000}}"/>
                <DataGridTextColumn Header="{Binding Source={Localization:Translate Word=筒子个数}}" Binding="{Binding Path=GLBSTSP}"  Width="Auto"/>
                <DataGridTextColumn  IsReadOnly="True"  Binding="{Binding Path=GLTARA,Converter={StaticResource ResourceKey=d1000}}" Header="{Binding Source={Localization:Translate Word=皮重}}"  Width="Auto"/> 
                <DataGridTextColumn Binding="{Binding Path=GLBEM,Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=备注}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid>
        <WrapPanel Grid.Row="2">
            <ex:TSUMWB/>
        </WrapPanel>     
    </Grid>
</me:UIGLLG>
